package router

import (
	"car-info-sys/handlers"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Init() *gin.Engine {

	r := gin.Default()

	r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, "hello World!")
	})

	r.POST("user/login", handlers.Login)

	r.POST("user/roleNodeAdd", handlers.RoleNodeAdd)

	r.GET("user/userRoleList", handlers.UserRoleList)

	r.GET("user/roleNodeList", handlers.RoleNodeList)

	r.POST("user/carAdd", handlers.CarAdd)

	r.POST("user/carTypeAdd", handlers.CarTypeAdd)

	r.GET("user/carList", handlers.CarList)

	r.GET("user/carDetail", handlers.CarDetail)

	return r
}
